<?php
class AboutManager extends ObjectManager{
	public function addObject($object) {
		global $db;
		$content = $object ['noi_dung'];
		$images = $object ['anh_dai_dien'];
		$query = "insert into `tbl_about`(`noi_dung`, `anh_dai_dien`) VALUES ('" . $content . "','" . $images . "')";
		$result = mysqli_query ( $db, $query );
		if ($result) {
			return true;
		} else {
			return false;
		}
	}
	/* (non-PHPdoc)
	 * @see ObjectManager::deleteObject()
	 */
	public function deleteObject($id) {
		// TODO Auto-generated method stub
		global $db;
		$query = "delete from tbl_about where id=" . $id;
		$result = mysqli_query ( $db, $query );
		if ($result) {
			return true;
		} else
			return false;
	}

	/* (non-PHPdoc)
	 * @see ObjectManager::updateObject()
	 */
	public function updateObject($object) {
		// TODO Auto-generated method stub
		global $db;
		$query = "update tbl_about set noi_dung = '" . $object ['noi_dung'] . "', anh_dai_dien='" . $object ['anh_dai_dien'] . "' where id=" . $object ['id'];		

		$result = mysqli_query ( $db, $query );
		if ($result) {
			return true;
		} else
			return false;
	}

	/* (non-PHPdoc)
	 * @see ObjectManager::getObjects()
	 */
	public function getObjects() {
		// TODO Auto-generated method stub
		global $db;
		$query = "select * from tbl_about";
		$result = mysqli_query ( $db, $query );
		// echo mysqli_num_rows($result);
		return $result;
	}

	/* (non-PHPdoc)
	 * @see ObjectManager::findObjectsByText()
	 */
	public function findObjectsByText($text) {
		// TODO Auto-generated method stub
	}

	/* (non-PHPdoc)
	 * @see ObjectManager::check()
	 */
	public function check($id) {
		// TODO Auto-generated method stub
		global $db;
		$query = "select * from tbl_about where id= '" . $id . "'";
		$result = mysqli_query ( $db, $query );
		return $result;
	}
	public function getObject(){
		global $db;
		$query="select * from tbl_about";
		$result=mysqli_query($db,$query);
		return $result;
	}
	
}